package com.unionpay.atm.sdk;

import java.nio.charset.Charset;

/**
 * a demo of class UserIdentityComparison to give its usage.
 */
public class UserIdentityComparisonDemo {
	private static final int DIGEST_LENGTH = 32;            // sm3 digest length (bytes)
	
    // main is here: usage demo
    public static void main(String[] args) {
    	
    	// demo1
    	System.out.println("start:");
    	String sName = " 张三";
    	String sCertType = " 0 1";
    	String sCertNo = " 1236789545655a55 ";
    	UserIdentityComparison uic = new UserIdentityComparison(sName, sCertType, sCertNo);
    	byte []bArrUserInfo = uic.getUserInfoBytes();
    	byte[] bArrDigest = uic.calSM3Digest(bArrUserInfo);
    	System.out.println("bArrUserInfo:");
    	for(int i = 0; i < bArrUserInfo.length; ++i)
    	{
    		if(i % 4 == 0)
    			System.out.print(" ");
    		//System.out.printf("%02X", bArrUserInfo[i]);
    		System.out.println(bArrUserInfo);
    	}
    	System.out.println();
    	System.out.println("bArrDigest:");
    	for(int i = 0; i < DIGEST_LENGTH; ++i) 
    	{
    		if(i % 4 == 0)
    			System.out.print(" ");
    			//System.out.printf("%02X", bArrDigest[i]);
    			System.out.println(bArrDigest[i]);
    	}
    	System.out.println();
    	System.out.println("end");
   
	}

} // end of class UserIdentityComparisonDemo
